billing: Create LicenseLedger entry for guest user role changes.

As guest users are charged at a different rate on Zulip Cloud, it
makes sense to track these changes in our LicenseLedger table so
that we can have an accurate record of the use of licenses that
a realm has purchased.
This commit is contained in:
Lauryn Menard
2024-09-04 21:27:08 +02:00
committed by Tim Abbott
parent ac13546fa2
commit 4b954a42ef
27 changed files with 3809 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,33 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": "pm_NORMALIZED",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,81 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": {
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "123 Main St",
"line2": null,
"postal_code": "94105",
"state": "CA"
},
"email": null,
"name": "John Doe",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"display_brand": "visa",
"exp_month": 9,
"exp_year": 2025,
"fingerprint": "NORMALIZED",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1000000000,
"customer": "invoice_for_additional_license--Customer.create.1.json",
"id": "invoice_for_additional_license--Customer.retrieve.1.json",
"livemode": false,
"metadata": {},
"object": "payment_method",
"type": "card"
},
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,81 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": {
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "123 Main St",
"line2": null,
"postal_code": "94105",
"state": "CA"
},
"email": null,
"name": "John Doe",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"display_brand": "visa",
"exp_month": 9,
"exp_year": 2025,
"fingerprint": "NORMALIZED",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1000000000,
"customer": "invoice_for_additional_license--Customer.create.1.json",
"id": "invoice_for_additional_license--Customer.retrieve.1.json",
"livemode": false,
"metadata": {},
"object": "payment_method",
"type": "card"
},
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,81 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": {
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "123 Main St",
"line2": null,
"postal_code": "94105",
"state": "CA"
},
"email": null,
"name": "John Doe",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"display_brand": "visa",
"exp_month": 9,
"exp_year": 2025,
"fingerprint": "NORMALIZED",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1000000000,
"customer": "invoice_for_additional_license--Customer.create.1.json",
"id": "invoice_for_additional_license--Customer.retrieve.1.json",
"livemode": false,
"metadata": {},
"object": "payment_method",
"type": "card"
},
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,81 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": {
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "123 Main St",
"line2": null,
"postal_code": "94105",
"state": "CA"
},
"email": null,
"name": "John Doe",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"display_brand": "visa",
"exp_month": 9,
"exp_year": 2025,
"fingerprint": "NORMALIZED",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1000000000,
"customer": "invoice_for_additional_license--Customer.create.1.json",
"id": "invoice_for_additional_license--Customer.retrieve.1.json",
"livemode": false,
"metadata": {},
"object": "payment_method",
"type": "card"
},
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

View File

@@ -0,0 +1,60 @@
{
"data": [
{
"api_version": "2020-08-27",
"created": 1000000000,
"data": {
"object": {
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "invoice_for_additional_license--Customer.create.1.json",
"invoice_prefix": "NORMALIZED",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": "pm_NORMALIZED",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"next_invoice_sequence": 1,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
},
"previous_attributes": {
"invoice_settings": {
"default_payment_method": null
}
}
},
"id": "invoice_for_additional_license--Event.list.1.json",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "invoice_for_additional_license--Event.list.1.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
},
"type": "customer.updated"
}
],
"has_more": true,
"object": "list",
"url": "/v1/events"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,580 @@
{
"data": [
{
"api_version": "2020-08-27",
"created": 1000000000,
"data": {
"object": {
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 48000,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": "ch_NORMALIZED",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1000000000
}
},
"id": "invoice_for_additional_license--Event.list.3.json",
"livemode": false,
"object": "event",
"pending_webhooks": 1,
"request": {
"id": "invoice_for_additional_license--Event.list.2.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
},
"type": "invoice.payment_succeeded"
},
{
"api_version": "2020-08-27",
"created": 1000000000,
"data": {
"object": {
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 48000,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": "ch_NORMALIZED",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1000000000
}
},
"id": "invoice_for_additional_license--Event.list.3.json",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "invoice_for_additional_license--Event.list.2.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
},
"type": "invoice.paid"
},
{
"api_version": "2020-08-27",
"created": 1000000000,
"data": {
"object": {
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 48000,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": "ch_NORMALIZED",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1000000000
},
"previous_attributes": {
"amount_paid": 0,
"amount_remaining": 48000,
"attempt_count": 0,
"attempted": false,
"charge": null,
"paid": false,
"status": "open",
"status_transitions": {
"paid_at": null
}
}
},
"id": "invoice_for_additional_license--Event.list.3.json",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "invoice_for_additional_license--Event.list.2.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
},
"type": "invoice.updated"
}
],
"has_more": false,
"object": "list",
"url": "/v1/events"
}

View File

@@ -0,0 +1,6 @@
{
"data": [],
"has_more": false,
"object": "list",
"url": "/v1/events"
}

View File

@@ -0,0 +1,172 @@
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 0,
"amount_remaining": 48000,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": null,
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": null,
"object": "invoice",
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "auto"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}

View File

@@ -0,0 +1,164 @@
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 7781,
"amount_paid": 0,
"amount_remaining": 7781,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": 1000000000,
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_pdf": null,
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 7781,
"amount_excluding_tax": 7781,
"currency": "usd",
"description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1326337445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Invoice.create.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 7781,
"unit_amount_decimal": "7781"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "7781"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Invoice.create.2.json/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": 1000000000,
"number": null,
"object": "invoice",
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "auto"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 7781,
"subtotal_excluding_tax": 7781,
"tax": null,
"test_clock": null,
"total": 7781,
"total_discount_amounts": [],
"total_excluding_tax": 7781,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}

View File

@@ -0,0 +1,172 @@
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 0,
"amount_remaining": 48000,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}

View File

@@ -0,0 +1,164 @@
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 7781,
"amount_paid": 0,
"amount_remaining": 7781,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 7781,
"amount_excluding_tax": 7781,
"currency": "usd",
"description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1326337445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Invoice.create.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 7781,
"unit_amount_decimal": "7781"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "7781"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Invoice.create.2.json/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": 1000000000,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 7781,
"subtotal_excluding_tax": 7781,
"tax": null,
"test_clock": null,
"total": 7781,
"total_discount_amounts": [],
"total_excluding_tax": 7781,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}

View File

@@ -0,0 +1,6 @@
{
"data": [],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -0,0 +1,343 @@
{
"data": [
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 7781,
"amount_paid": 0,
"amount_remaining": 7781,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 7781,
"amount_excluding_tax": 7781,
"currency": "usd",
"description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Invoice.create.2.json",
"invoice": "invoice_for_additional_license--Invoice.create.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1326337445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Invoice.create.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 7781,
"unit_amount_decimal": "7781"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "7781"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Invoice.create.2.json/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": 1000000000,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 7781,
"subtotal_excluding_tax": 7781,
"tax": null,
"test_clock": null,
"total": 7781,
"total_discount_amounts": [],
"total_excluding_tax": 7781,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
},
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 48000,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": "ch_NORMALIZED",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1000000000
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -0,0 +1,172 @@
{
"account_country": "US",
"account_name": "Kandra Labs, Inc.",
"account_tax_ids": null,
"amount_due": 48000,
"amount_paid": 48000,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"automatically_finalizes_at": null,
"billing_reason": "manual",
"charge": "ch_NORMALIZED",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
"amount": 48000,
"amount_excluding_tax": 48000,
"currency": "usd",
"description": "Zulip Cloud Standard",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": "invoice_for_additional_license--Event.list.2.json",
"invoice_item": "ii_NORMALIZED",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "8000"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/invoice_for_additional_license--Event.list.2.json/lines"
},
"livemode": false,
"metadata": {
"billing_schedule": "1",
"current_plan_id": "None",
"license_management": "automatic",
"licenses": "6",
"on_free_trial": "False",
"plan_tier": "1",
"user_id": "10"
},
"next_payment_attempt": null,
"number": "NORMALIZED",
"object": "invoice",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": "pi_NORMALIZED",
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering": {
"amount_tax_display": null,
"pdf": {
"page_size": "letter"
}
},
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Cloud Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 48000,
"subtotal_excluding_tax": 48000,
"tax": null,
"test_clock": null,
"total": 48000,
"total_discount_amounts": [],
"total_excluding_tax": 48000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1000000000
}

View File

@@ -0,0 +1,47 @@
{
"amount": 48000,
"currency": "usd",
"customer": "cus_NORMALIZED",
"date": 1000000000,
"description": "Zulip Cloud Standard",
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--Event.list.2.json",
"invoice": null,
"livemode": false,
"metadata": {},
"object": "invoiceitem",
"period": {
"end": 1357095845,
"start": 1325473445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Event.list.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
"quantity": 6,
"subscription": null,
"tax_rates": [],
"test_clock": null,
"unit_amount": 8000,
"unit_amount_decimal": "8000"
}

View File

@@ -0,0 +1,47 @@
{
"amount": 7781,
"currency": "usd",
"customer": "cus_NORMALIZED",
"date": 1000000000,
"description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
"discountable": false,
"discounts": [],
"id": "invoice_for_additional_license--InvoiceItem.create.2.json",
"invoice": null,
"livemode": false,
"metadata": {},
"object": "invoiceitem",
"period": {
"end": 1357095845,
"start": 1326337445
},
"plan": null,
"price": {
"active": false,
"billing_scheme": "per_unit",
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
"id": "invoice_for_additional_license--Invoice.create.2.json",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_NORMALIZED",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 7781,
"unit_amount_decimal": "7781"
},
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"test_clock": null,
"unit_amount": 7781,
"unit_amount_decimal": "7781"
}

View File

@@ -0,0 +1,49 @@
{
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": "San Francisco",
"country": "US",
"line1": "123 Main St",
"line2": null,
"postal_code": "94105",
"state": "CA"
},
"email": null,
"name": "John Doe",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "unchecked",
"address_postal_code_check": "unchecked",
"cvc_check": "unchecked"
},
"country": "US",
"display_brand": "visa",
"exp_month": 9,
"exp_year": 2025,
"fingerprint": "NORMALIZED",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1000000000,
"customer": null,
"id": "invoice_for_additional_license--Customer.retrieve.1.json",
"livemode": false,
"metadata": {},
"object": "payment_method",
"type": "card"
}

View File

@@ -0,0 +1,34 @@
{
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "NORMALIZED",
"created": 1000000000,
"customer": "cus_NORMALIZED",
"description": null,
"flow_directions": null,
"id": "invoice_for_additional_license--SetupIntent.create.1.json",
"last_setup_error": null,
"latest_attempt": "setatt_NORMALIZED",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
"payment_method": "pm_NORMALIZED",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "succeeded",
"usage": "off_session"
}

View File

@@ -0,0 +1,41 @@
{
"data": [
{
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "NORMALIZED",
"created": 1000000000,
"customer": "cus_NORMALIZED",
"description": null,
"flow_directions": null,
"id": "invoice_for_additional_license--SetupIntent.list.1.json",
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
"payment_method": null,
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "requires_payment_method",
"usage": "off_session"
}
],
"has_more": false,
"object": "list",
"url": "/v1/setup_intents"
}

View File

@@ -0,0 +1,34 @@
{
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "NORMALIZED",
"created": 1000000000,
"customer": "cus_NORMALIZED",
"description": null,
"flow_directions": null,
"id": "invoice_for_additional_license--SetupIntent.create.1.json",
"last_setup_error": null,
"latest_attempt": "setatt_NORMALIZED",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
"payment_method": "pm_NORMALIZED",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "succeeded",
"usage": "off_session"
}

View File

@@ -0,0 +1,80 @@
{
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_address_collection": "required",
"cancel_url": "http://zulip.testserver/upgrade/?manual_license_management=false&tier=1",
"client_reference_id": null,
"client_secret": null,
"consent": null,
"consent_collection": null,
"created": 1000000000,
"currency": null,
"currency_conversion": null,
"custom_fields": [],
"custom_text": {
"after_submit": null,
"shipping_address": null,
"submit": null,
"terms_of_service_acceptance": null
},
"customer": "cus_NORMALIZED",
"customer_creation": null,
"customer_details": {
"address": null,
"email": "hamlet@zulip.com",
"name": null,
"phone": null,
"tax_exempt": null,
"tax_ids": null
},
"customer_email": null,
"expires_at": 1000000000,
"id": "invoice_for_additional_license--checkout.Session.create.1.json",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
"type": "card_update",
"user_id": "10"
},
"mode": "setup",
"object": "checkout.session",
"payment_intent": null,
"payment_link": null,
"payment_method_collection": "always",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"payment_status": "no_payment_required",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"saved_payment_method_options": null,
"setup_intent": "seti_NORMALIZED",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "open",
"submit_type": null,
"subscription": null,
"success_url": "http://zulip.testserver/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
"url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED"
}

View File

@@ -0,0 +1,87 @@
{
"data": [
{
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_address_collection": "required",
"cancel_url": "http://zulip.testserver/upgrade/?manual_license_management=false&tier=1",
"client_reference_id": null,
"client_secret": null,
"consent": null,
"consent_collection": null,
"created": 1000000000,
"currency": null,
"currency_conversion": null,
"custom_fields": [],
"custom_text": {
"after_submit": null,
"shipping_address": null,
"submit": null,
"terms_of_service_acceptance": null
},
"customer": "cus_NORMALIZED",
"customer_creation": null,
"customer_details": {
"address": null,
"email": "hamlet@zulip.com",
"name": null,
"phone": null,
"tax_exempt": null,
"tax_ids": null
},
"customer_email": null,
"expires_at": 1000000000,
"id": "invoice_for_additional_license--checkout.Session.create.1.json",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
"type": "card_update",
"user_id": "10"
},
"mode": "setup",
"object": "checkout.session",
"payment_intent": null,
"payment_link": null,
"payment_method_collection": "always",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"payment_status": "no_payment_required",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"saved_payment_method_options": null,
"setup_intent": "seti_NORMALIZED",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "open",
"submit_type": null,
"subscription": null,
"success_url": "http://zulip.testserver/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
"url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED"
}
],
"has_more": false,
"object": "list",
"url": "/v1/checkout/sessions"
}

View File

@@ -86,7 +86,7 @@ from zerver.actions.create_user import (
do_reactivate_user,
)
from zerver.actions.realm_settings import do_deactivate_realm, do_reactivate_realm
from zerver.actions.users import do_deactivate_user
from zerver.actions.users import do_change_user_role, do_deactivate_user
from zerver.lib.remote_server import send_server_data_to_push_bouncer
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import activate_push_notification_service
@@ -5713,6 +5713,19 @@ class LicenseLedgerTest(StripeTestCase):
do_reactivate_user(user, acting_user=None)
# Not a proper use of do_activate_mirror_dummy_user, but fine for this test
do_activate_mirror_dummy_user(user, acting_user=None)
# Add a guest user
guest = do_create_user(
"guest_email",
"guest_password",
get_realm("zulip"),
"guest_name",
role=UserProfile.ROLE_GUEST,
acting_user=None,
)
# Change guest user role to member
do_change_user_role(guest, UserProfile.ROLE_MEMBER, acting_user=None)
# Change again to moderator, no LicenseLedger created
do_change_user_role(guest, UserProfile.ROLE_MODERATOR, acting_user=None)
ledger_entries = list(
LicenseLedger.objects.values_list(
"is_renewal", "licenses", "licenses_at_next_renewal"
@@ -5726,6 +5739,8 @@ class LicenseLedgerTest(StripeTestCase):
(False, self.seat_count + 1, self.seat_count),
(False, self.seat_count + 1, self.seat_count + 1),
(False, self.seat_count + 1, self.seat_count + 1),
(False, self.seat_count + 1, self.seat_count + 1),
(False, self.seat_count + 2, self.seat_count + 2),
],
)
@@ -5897,6 +5912,52 @@ class InvoiceTest(StripeTestCase):
assert plan is not None
self.assertEqual(plan.next_invoice_date, self.next_month + timedelta(days=29))
@mock_stripe()
def test_invoice_for_additional_license(self, *mocks: Mock) -> None:
user = self.example_user("hamlet")
self.login_user(user)
with time_machine.travel(self.now, tick=False):
self.add_card_and_upgrade(user)
plan = CustomerPlan.objects.first()
assert plan is not None
self.assertEqual(plan.next_invoice_date, self.next_month)
assert plan.customer.realm is not None
realm = plan.customer.realm
# Adding a guest user and then changing their role to member
# should invoice for a pro-rated license at the next invoice
# date on a plan with annual billing.
with time_machine.travel(self.now + timedelta(days=5), tick=False):
user = do_create_user(
"email",
"password",
realm,
"name",
role=UserProfile.ROLE_GUEST,
acting_user=None,
)
with time_machine.travel(self.now + timedelta(days=10), tick=False):
do_change_user_role(user, UserProfile.ROLE_MEMBER, acting_user=None)
billing_session = RealmBillingSession(realm=realm)
billing_session.invoice_plan(plan, self.next_month)
plan = CustomerPlan.objects.first()
assert plan is not None
self.assertEqual(plan.next_invoice_date, self.next_month + timedelta(days=29))
stripe_customer_id = plan.customer.stripe_customer_id
assert stripe_customer_id is not None
[invoice0, invoice1] = iter(stripe.Invoice.list(customer=stripe_customer_id))
self.assertIsNotNone(invoice0.status_transitions.finalized_at)
[item0] = iter(invoice0.lines)
line_item_params = {
"amount": int(8000 * (1 - ((366 - 356) / 366)) + 0.5),
"description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
"quantity": 1,
}
for key, value in line_item_params.items():
self.assertEqual(item0.get(key), value)
class TestTestClasses(ZulipTestCase):
def test_subscribe_realm_to_manual_license_management_plan(self) -> None: