type Shopify = {
token: string;
store_name: string;
};
/**
* Updates an order risk
* Updates an order risk Note You cannot modify an order risk that was created by another application.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
order_id: string,
risk_id: string,
body: {
risk?: {
cause_cancel?: boolean;
id?: number;
message?: string;
recommendation?: string;
score?: number;
source?: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/orders/${order_id}/risks/${risk_id}.json`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 396 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Updates an order risk
* Updates an order risk Note You cannot modify an order risk that was created by another application.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
order_id: string,
risk_id: string,
body: {
risk?: {
cause_cancel?: boolean;
id?: number;
message?: string;
recommendation?: string;
score?: number;
source?: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/orders/${order_id}/risks/${risk_id}.json`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 942 days ago