This commit is contained in:
@@ -50,6 +50,21 @@ export interface CartPaymentRequest {
|
||||
items: Array<{ itemID: number; price: number; name: string; quantity?: number; delivery?: DeliveryOption[] }>;
|
||||
}
|
||||
|
||||
export interface CreateOrderRequest {
|
||||
items: Array<{ productId: string; name: string; quantity: number; price: number }>;
|
||||
customer: { name: string; email: string; phone: string };
|
||||
payment?: { method: string; currency: string };
|
||||
shipping?: { address: string; method: string; trackingNumber: string };
|
||||
}
|
||||
|
||||
export interface CreateOrderResponse {
|
||||
id: string;
|
||||
orderNumber: string;
|
||||
status: string;
|
||||
total: number;
|
||||
currency: string;
|
||||
}
|
||||
|
||||
export interface QrDynamicStatusResponse {
|
||||
additionalInfo: string;
|
||||
paymentPurpose: string;
|
||||
@@ -614,6 +629,15 @@ export class ApiService {
|
||||
return this.http.post<QrCreateResponse>(`${this.baseUrl}/cart`, payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Records the just-paid cart as a backoffice order (POST /orders). Fire-and-forget
|
||||
* from the caller's perspective - a failure here must never block the existing
|
||||
* payment-confirmed flow, since payment itself is unaffected by this call.
|
||||
*/
|
||||
createOrder(payload: CreateOrderRequest): Observable<CreateOrderResponse> {
|
||||
return this.http.post<CreateOrderResponse>(`${this.baseUrl}/orders`, payload);
|
||||
}
|
||||
|
||||
checkCartPaymentStatus(qrId: string): Observable<QrDynamicStatusResponse> {
|
||||
return this.http.get<QrDynamicStatusResponse>(
|
||||
`${this.qrBaseUrl}/qr/dynamic/${this.cartPaymentPartnerId}/${encodeURIComponent(qrId)}`
|
||||
|
||||
Reference in New Issue
Block a user