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:
parent
ed001fd0b0
commit
ea34f302ac
1 changed files with 23 additions and 26 deletions
|
|
@ -531,33 +531,30 @@
|
|||
|
||||
<!--- Get brand color, tax rate, payfrit fee, and header image for this business --->
|
||||
<cfset brandColor = "">
|
||||
<cfset businessTaxRate = 0>
|
||||
<cfset businessPayfritFee = 0.065>
|
||||
<cfset headerImageUrl = "">
|
||||
<cftry>
|
||||
<cfset qBrand = queryTimed(
|
||||
"SELECT BrandColor AS BusinessBrandColor, TaxRate, PayfritFee, HeaderImageExtension FROM Businesses WHERE ID = ?",
|
||||
[ { value = BusinessID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfif qBrand.recordCount GT 0>
|
||||
<cfif len(trim(qBrand.BusinessBrandColor))>
|
||||
<cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor>
|
||||
</cfif>
|
||||
<cfif isNumeric(qBrand.TaxRate)>
|
||||
<cfset businessTaxRate = qBrand.TaxRate>
|
||||
</cfif>
|
||||
<cfif isNumeric(qBrand.PayfritFee)>
|
||||
<cfset businessPayfritFee = qBrand.PayfritFee>
|
||||
</cfif>
|
||||
<cfif len(trim(qBrand.HeaderImageExtension))>
|
||||
<cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#">
|
||||
</cfif>
|
||||
</cfif>
|
||||
<cfcatch>
|
||||
<!--- Column may not exist yet, ignore --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfset qBrand = queryTimed(
|
||||
"SELECT BrandColor AS BusinessBrandColor, TaxRate, PayfritFee, HeaderImageExtension FROM Businesses WHERE ID = ?",
|
||||
[ { value = BusinessID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<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))>
|
||||
<cfset brandColor = left(qBrand.BusinessBrandColor, 1) EQ chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor>
|
||||
</cfif>
|
||||
<cfif len(trim(qBrand.HeaderImageExtension))>
|
||||
<cfset headerImageUrl = "/uploads/headers/#BusinessID#.#qBrand.HeaderImageExtension#">
|
||||
</cfif>
|
||||
|
||||
<cfset apiAbort({
|
||||
"OK": true,
|
||||
|
|
|
|||
Reference in a new issue