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 GT 0> <cfif qBrand.recordCount EQ 0>
<cfset apiAbort({ "OK": false, "ERROR": "business_not_found" })>
</cfif>
<!--- TaxRate and PayfritFee MUST be configured - no fallbacks --->
<cfif NOT isNumeric(qBrand.TaxRate)>
<cfset apiAbort({ "OK": false, "ERROR": "business_tax_rate_not_configured" })>
</cfif>
<cfif NOT isNumeric(qBrand.PayfritFee) OR qBrand.PayfritFee LTE 0>
<cfset apiAbort({ "OK": false, "ERROR": "business_payfrit_fee_not_configured" })>
</cfif>
<cfset businessTaxRate = qBrand.TaxRate>
<cfset businessPayfritFee = qBrand.PayfritFee>
<cfif len(trim(qBrand.BusinessBrandColor))> <cfif len(trim(qBrand.BusinessBrandColor))>
<cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor> <cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor>
</cfif> </cfif>
<cfif isNumeric(qBrand.TaxRate)>
<cfset businessTaxRate = qBrand.TaxRate>
</cfif>
<cfif isNumeric(qBrand.PayfritFee)>
<cfset businessPayfritFee = qBrand.PayfritFee>
</cfif>
<cfif len(trim(qBrand.HeaderImageExtension))> <cfif len(trim(qBrand.HeaderImageExtension))>
<cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#"> <cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#">
</cfif> </cfif>
</cfif>
<cfcatch>
<!--- Column may not exist yet, ignore --->
</cfcatch>
</cftry>
<cfset apiAbort({ <cfset apiAbort({
"OK": true, "OK": true,