console.log(auths.shopify.oauth_access_token);
return await require("@pipedreamhq/platform").axios(this, {
method: "post",
url: `https://${auths.shopify.shop_id}.myshopify.com/admin/api/2020-01/draft_orders.json`,
headers: {
"X-Shopify-Access-Token": `${auths.shopify.oauth_access_token}`,
"Content-Type": `application/json`,
},
data: {
draft_order: {
name: params.name,
customer: typeof params.customer == 'undefined' ? params.customer : JSON.parse(params.customer),
shipping_address: typeof params.shipping_address == 'undefined' ? params.shipping_address : JSON.parse(params.shipping_address),
billing_address: typeof params.billing_address == 'undefined' ? params.billing_address : JSON.parse(params.billing_address),
note: params.note,
note_attributes: typeof params.note_attributes == 'undefined' ? params.note_attributes : JSON.parse(params.note_attributes),
email: params.email,
currency: params.currency,
invoice_sent_at: params.invoice_sent_at,
invoice_url: params.invoice_url,
line_items: typeof params.line_items == 'undefined' ? params.line_items : JSON.parse(params.line_items),
shipping_line: typeof params.shipping_line == 'undefined' ? params.shipping_line : JSON.parse(params.shipping_line),
tags: params.tags,
tax_exempt: params.tax_exempt,
tax_exemptions: typeof params.tax_exemptions == 'undefined' ? params.tax_exemptions : JSON.parse(params.tax_exemptions),
tax_lines: typeof params.tax_lines == 'undefined' ? params.tax_lines : JSON.parse(params.tax_lines),
applied_discount: typeof params.applied_discount == 'undefined' ? params.applied_discount : JSON.parse(params.applied_discount),
taxes_included: params.taxes_included,
total_tax: params.total_tax,
subtotal_price: params.subtotal_price,
total_price: params.total_price,
completed_at: params.completed_at,
created_at: params.created_at,
updated_at: params.updated_at,
status: params.status,
use_customer_default_address: params.use_customer_default_address,
customer_id : params.customer_id
}
}
})