This repository has been archived on 2026-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
payfrit-biz/api/orders/testMarkPaid.cfm
John Mizerek 31a89018f5 Launch prep: fix menu builder, payment flow, comment out pre-launch features
- Fix menu builder dropdown showing empty names (return MenuName instead of Name)
- Add default menu selection (setDefault action, DefaultMenuID in getForBuilder)
- Fix createPaymentIntent column names for dev schema (ID, StripeAccountID, etc.)
- Fix menu-builder favicon and remove redundant business label
- Comment out Tabs/Running Checks feature for launch (HTML + JS)
- Comment out Service Point Marketing/Grants feature for launch (HTML + JS)
- Add testMarkPaid.cfm for testing orders without Stripe webhooks
- Task API updates for worker payout ledger integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:18:33 -08:00

55 lines
1.5 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
/**
* TEST ONLY: Mark an order as submitted and paid without Stripe
* This bypasses the payment flow for development testing
*
* POST: { OrderID: int }
*/
response = { "OK": false };
try {
requestData = deserializeJSON(toString(getHttpRequestData().content));
orderID = val(requestData.OrderID ?: 0);
if (orderID == 0) {
response["ERROR"] = "OrderID is required";
writeOutput(serializeJSON(response));
abort;
}
// Check order exists
qOrder = queryExecute("
SELECT ID, StatusID, PaymentStatus FROM Orders WHERE ID = :orderID
", { orderID: orderID }, { datasource: "payfrit" });
if (qOrder.recordCount == 0) {
response["ERROR"] = "Order not found";
writeOutput(serializeJSON(response));
abort;
}
// Mark as submitted and paid
queryExecute("
UPDATE Orders
SET StatusID = 1,
PaymentStatus = 'paid',
PaymentCompletedOn = NOW(),
SubmittedOn = COALESCE(SubmittedOn, NOW()),
LastEditedOn = NOW()
WHERE ID = :orderID
", { orderID: orderID }, { datasource: "payfrit" });
response["OK"] = true;
response["MESSAGE"] = "Order #orderID# marked as submitted and paid";
} catch (any e) {
response["ERROR"] = e.message;
}
writeOutput(serializeJSON(response));
</cfscript>