Require TaxRate and PayfritFee to be configured - no fallbacks

Both values MUST be set per business. If not configured, the menu
API will return an error instead of silently using defaults.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-19 11:31:31 -08:00
parent ed001fd0b0
commit ea34f302ac

View file

@ -531,33 +531,30 @@
<!--- Get brand color, tax rate, payfrit fee, and header image for this business ---> <!--- Get brand color, tax rate, payfrit fee, and header image for this business --->
<cfset brandColor = ""> <cfset brandColor = "">
<cfset businessTaxRate = 0>
<cfset businessPayfritFee = 0.065>
<cfset headerImageUrl = ""> <cfset headerImageUrl = "">
<cftry> <cfset qBrand = queryTimed(
<cfset qBrand = queryTimed( "SELECT BrandColor AS BusinessBrandColor, TaxRate, PayfritFee, HeaderImageExtension FROM Businesses WHERE ID = ?",
"SELECT BrandColor AS BusinessBrandColor, TaxRate, PayfritFee, HeaderImageExtension FROM Businesses WHERE ID = ?", [ { value = BusinessID, cfsqltype = "cf_sql_integer" } ],
[ { value = BusinessID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" }
{ datasource = "payfrit" } )>
)> <cfif qBrand.recordCount EQ 0>
<cfif qBrand.recordCount GT 0> <cfset apiAbort({ "OK": false, "ERROR": "business_not_found" })>
<cfif len(trim(qBrand.BusinessBrandColor))> </cfif>
<cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor> <!--- TaxRate and PayfritFee MUST be configured - no fallbacks --->
</cfif> <cfif NOT isNumeric(qBrand.TaxRate)>
<cfif isNumeric(qBrand.TaxRate)> <cfset apiAbort({ "OK": false, "ERROR": "business_tax_rate_not_configured" })>
<cfset businessTaxRate = qBrand.TaxRate> </cfif>
</cfif> <cfif NOT isNumeric(qBrand.PayfritFee) OR qBrand.PayfritFee LTE 0>
<cfif isNumeric(qBrand.PayfritFee)> <cfset apiAbort({ "OK": false, "ERROR": "business_payfrit_fee_not_configured" })>
<cfset businessPayfritFee = qBrand.PayfritFee> </cfif>
</cfif> <cfset businessTaxRate = qBrand.TaxRate>
<cfif len(trim(qBrand.HeaderImageExtension))> <cfset businessPayfritFee = qBrand.PayfritFee>
<cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#"> <cfif len(trim(qBrand.BusinessBrandColor))>
</cfif> <cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor>
</cfif> </cfif>
<cfcatch> <cfif len(trim(qBrand.HeaderImageExtension))>
<!--- Column may not exist yet, ignore ---> <cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#">
</cfcatch> </cfif>
</cftry>
<cfset apiAbort({ <cfset apiAbort({
"OK": true, "OK": true,