| 901 | 901 | | ("subscription_data[metadata][workspace]", workspace.to_owned()), |
| 902 | 902 | | ("subscription_data[metadata][feature]", feature.to_owned()), |
| 903 | 903 | | ]; |
| 904 | | − | fields.extend(page_line(monthly_cents, format!("g1t {title} for {workspace}"), None, true)); |
| 904 | + | fields.extend(page_line(monthly_cents, plan_line_name(title, workspace), None, true)); |
| 905 | 905 | | fields.extend(checkout_tax_fields(customer)); |
| 906 | 906 | | if let Some(customer) = customer { |
| 907 | 907 | | fields.push(("customer", customer.to_owned())); |
| ⋯ |
| 909 | 909 | | fields |
| 910 | 910 | | } |
| 911 | 911 | | |
| 912 | + | /// What a plan is called on Stripe's page and the receipts: "g1t plan for |
| 913 | + | /// acme", "g1t Deployments plan for acme"; never "g1t g1t". |
| 914 | + | pub(crate) fn plan_line_name(title: &str, workspace: &str) -> String { |
| 915 | + | if title == "g1t" { format!("g1t plan for {workspace}") } else { format!("g1t {title} plan for {workspace}") } |
| 916 | + | } |
| 917 | + | |
| 912 | 918 | | /// A card check's page's fields: setup mode, nothing charged, so nothing |
| 913 | 919 | | /// to tax. Setup mode takes no line items and no amount. The billing |
| 914 | 920 | | /// address is asked for all the same, and copied onto the customer once |
| ⋯ |
| 1196 | 1202 | | fn untaxed_requests_lose_only_automatic_tax() { |
| 1197 | 1203 | | let body = form(&[("mode", "payment".to_owned()), ("automatic_tax[enabled]", "true".to_owned()), ("tax_id_collection[enabled]", "true".to_owned())]); |
| 1198 | 1204 | | assert_eq!(without_automatic_tax(&body), form(&[("mode", "payment".to_owned()), ("tax_id_collection[enabled]", "true".to_owned())])); |
| 1205 | + | assert_eq!(plan_line_name("g1t", "acme"), "g1t plan for acme"); |
| 1206 | + | assert_eq!(plan_line_name("Deployments", "acme"), "g1t Deployments plan for acme"); |
| 1199 | 1207 | | assert!(taxed_path("/checkout/sessions") && taxed_path("/invoices") && taxed_path("/subscriptions")); |
| 1200 | 1208 | | // An enrollment converting to the plan turns tax on by updating it. |
| 1201 | 1209 | | assert!(taxed_path("/subscriptions/sub_1") && taxed_path("/subscriptions/sub_1?expand[]=latest_invoice")); |