Skip to content

Commit

Permalink
Exclude IRA rebates from v1 (#471)
Browse files Browse the repository at this point in the history
## Description

The embed is already filtering these out and replacing them with its
own content. I'd say PEP shouldn't be showing them at all, since
they're not actionable.

We do still need to keep them in the v0 API, to avoid disrupting the
legacy embed and v0 API clients.

The boolean flag is inelegant, but it will be removed along with the
v0 API.

## Test Plan

`yarn test` with new/updated tests.
  • Loading branch information
oyamauchi authored May 21, 2024
1 parent 556b003 commit e828f47
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 391 deletions.
13 changes: 12 additions & 1 deletion src/lib/incentives-calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type CalculateParams = Omit<APICalculatorRequest, 'location'>;
function calculateFederalIncentivesAndSavings(
amiAndEvCreditEligibility: AMIAndEVCreditEligibility,
solarSystemCost: number,
excludeIRARebates: boolean,
{ tax_filing, owner_status, household_income, items }: CalculateParams,
): {
federalIncentives: CalculatedIncentive[];
Expand All @@ -76,6 +77,14 @@ function calculateFederalIncentivesAndSavings(
continue;
}

if (
excludeIRARebates &&
(incentive.payment_methods[0] === PaymentMethod.PosRebate ||
incentive.payment_methods[0] === PaymentMethod.PerformanceRebate)
) {
continue;
}

//
// 1) Verify that the selected homeowner status qualifies
//
Expand Down Expand Up @@ -190,7 +199,7 @@ function calculateFederalIncentivesAndSavings(
savings.pos_rebate =
household_income < amiAndEvCreditEligibility.computedAMI150 &&
owner_status !== 'renter'
? MAX_POS_SAVINGS
? Math.min(MAX_POS_SAVINGS, savings.pos_rebate)
: 0;

return {
Expand All @@ -203,6 +212,7 @@ export default function calculateIncentives(
location: ResolvedLocation,
amiAndEvCreditEligibility: AMIAndEVCreditEligibility,
request: CalculateParams,
excludeIRARebates: boolean = false,
): CalculatedIncentives {
const {
owner_status,
Expand Down Expand Up @@ -285,6 +295,7 @@ export default function calculateIncentives(
const federal = calculateFederalIncentivesAndSavings(
amiAndEvCreditEligibility,
SOLAR_PRICES[state_id]?.system_cost,
excludeIRARebates,
request,
);
incentives.push(...federal.federalIncentives);
Expand Down
1 change: 1 addition & 0 deletions src/routes/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default async function (
location,
amiAndEvCreditEligibility,
{ ...request.query },
true,
);
const translated = {
...result,
Expand Down
195 changes: 0 additions & 195 deletions test/fixtures/v1-15289-homeowner-85000-joint-4.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,201 +43,6 @@
"eligible": false,
"short_description": "Free energy audit and weatherization services for income-qualified residents. Average value per household is $7,669 depending on results."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"heat_pump_air_conditioner_heater"
],
"amount": {
"type": "dollar_amount",
"number": 8000
},
"owner_status": [
"homeowner",
"renter"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Low-income households get a 100% rebate on heat pumps up to $8,000; moderate-income households get 50% up to $8,000."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"electric_panel"
],
"amount": {
"type": "dollar_amount",
"number": 4000
},
"owner_status": [
"homeowner"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Rebate up to $4,000 for electrical panel costs. Low-income households receive 100%. Moderate-income households receive 50%."
},
{
"payment_methods": [
"performance_rebate"
],
"authority_type": "federal",
"program": "Federal Home Efficiency Rebates (HER)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-efficiency-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-efficiency-rebates",
"items": [
"efficiency_rebates"
],
"amount": {
"type": "dollar_amount",
"number": 4000
},
"owner_status": [
"homeowner"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "more_than_80_ami",
"eligible": true,
"short_description": "Rebate up to $8,000 for low and moderate income households and up to $4,000 for all other households for energy efficiency retrofits."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"electric_wiring"
],
"amount": {
"type": "dollar_amount",
"number": 2500
},
"owner_status": [
"homeowner"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Electrification rebates for electric wiring. Low-income: 100% coverage up to $2,500. Moderate-income: 50% up to $2,500."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"heat_pump_water_heater"
],
"amount": {
"type": "dollar_amount",
"number": 1750
},
"owner_status": [
"homeowner"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Rebate up to $1,750 for heat pump water heaters: 100% for low-income households, 50% for moderate-income households."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-efficiency-rebates",
"items": [
"weatherization"
],
"amount": {
"type": "dollar_amount",
"number": 1600
},
"owner_status": [
"homeowner"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Weatherization rebates cover insulation, air sealing, ventilation. Low-income: 100% up to $1,600. Moderate-income: 50% up to $1,600."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"electric_stove"
],
"amount": {
"type": "dollar_amount",
"number": 840
},
"owner_status": [
"homeowner",
"renter"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Electrification rebates for electric and induction stoves. Low-income: 100% coverage up to $840. Moderate-income: 50% up to $840."
},
{
"payment_methods": [
"pos_rebate"
],
"authority_type": "federal",
"program": "Federal Home Electrification and Appliance Rebates (HEAR)",
"program_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"more_info_url": "https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates",
"items": [
"heat_pump_clothes_dryer"
],
"amount": {
"type": "dollar_amount",
"number": 840
},
"owner_status": [
"homeowner",
"renter"
],
"start_date": "2025",
"end_date": "2032",
"ami_qualification": "less_than_150_ami",
"eligible": true,
"short_description": "Rebate up to $840 for heat pump dryers. Low-income households: 100% rebate, Moderate-income: 50% rebate."
},
{
"payment_methods": [
"rebate"
Expand Down
Loading

0 comments on commit e828f47

Please sign in to comment.