fix: stop sending client-computed price on order creation
createOrder() sent a discount-applied price per line item that the client computed itself, with no server revalidation. Items now only carry productId/name/quantity - the backend must price from its own catalog. createPayment()'s amount (required to actually charge the payment gateway) is unchanged; backend must revalidate it instead, tracked in BACKEND-API-REFERENCE.md §12. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,12 @@ export interface CartPaymentRequest {
|
||||
}
|
||||
|
||||
export interface CreateOrderRequest {
|
||||
items: Array<{ productId: string; name: string; quantity: number; price: number }>;
|
||||
/**
|
||||
* No `price` field: the backend must price each line item from its own
|
||||
* catalog by `productId`, never trust a client-supplied amount.
|
||||
* See BACKEND-API-REFERENCE.md §12.
|
||||
*/
|
||||
items: Array<{ productId: string; name: string; quantity: number }>;
|
||||
customer: { name: string; email: string; phone: string };
|
||||
payment?: { method: string; currency: string };
|
||||
shipping?: { address: string; method: string; trackingNumber: string };
|
||||
|
||||
Reference in New Issue
Block a user