Skip to content

Commit

Permalink
Merge pull request #17 from shopware/order-status-helper
Browse files Browse the repository at this point in the history
feat: Add order status helper method
  • Loading branch information
Phil23 authored Jun 7, 2024
2 parents 16f2a21 + ade2aa9 commit 15ce53f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/services/ShopwareDataHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { APIResponse } from '@playwright/test';
import { AdminApiContext } from './AdminApiContext';

export const getLanguageData = async (
Expand Down Expand Up @@ -233,4 +234,9 @@ export const getMediaId = async (fileName: string, adminApiContext: AdminApiCont
export function extractIdFromUrl(url: string): string | null {
const segments = url.split('/');
return segments.length > 0 ? segments[segments.length - 1] : null;
}
}

type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
export const setOrderStatus = async (orderId: string, orderStatus: OrderStatus , adminApiContext: AdminApiContext): Promise<APIResponse> => {
return await adminApiContext.post(`./_action/order/${orderId}/state/${orderStatus}`);
};

0 comments on commit 15ce53f

Please sign in to comment.