A command-line-interface (CLI) which allows you to easily perform custom tasks for your vendhq.com instance
it's as simple as posting
{
"id": "some_sale_id",
"status": "VOIDED"
}
to the /api/register_sales
endpoint. Of course that's a simplified payload. You should probably just grab the whole sale payload, change the status and post it back.
@pzurek
Unfortunately this doesnt work for me:
Vend.voidSale = function(sale) {
var url = Meteor.settings.private.vend.api_base_url,
headers = {
'Authorization': 'Bearer' + Vend.settings.accessToken,
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
};
sale.status = 'VOIDED';
var response = HTTP.post(url + '/api/register_sales', {params: sale, headers: headers});
};
result {
register_sale:
{
id: '02d59481-b6ad-11e5-f667-c057f2330ec6',
register_id: '02d59481-b67d-11e5-f667-ba2e7c3a87f7',
market_id: '1',
customer_id: '02d59481-b6ad-11e5-f667-bb1a91446409',
customer_name: 'Ron',
customer:
{
id: '02d59481-b6ad-11e5-f667-bb1a91446409',
name: 'Ron',
customer_code: 'Ron-AH76',
customer_group_id: '02d59481-b6ad-11e5-f667-bb1a913fc935',
customer_group_name: 'Southwest Enterprise',
first_name: 'Ron',
last_name: 'Tenenbaum',
company_name: '',
phone: '',
mobile: '',
fax: '',
email: '',
twitter: '',
website: '',
physical_address1: '',
physical_address2: '',
physical_suburb: '',
physical_city: '',
physical_postcode: '',
physical_state: '',
physical_country_id: 'SG',
postal_address1: '',
postal_address2: '',
postal_suburb: '',
postal_city: '',
postal_postcode: '',
postal_state: '',
postal_country_id: 'SG',
updated_at: '2016-01-21 15:11:22',
deleted_at: '',
balance: '-250.000',
year_to_date: '250.00000',
date_of_birth: '',
sex: '',
custom_field_1: '',
custom_field_2: '',
custom_field_3: '',
custom_field_4: '',
note: '',
contact: [Object]
},
user_id: '02d59481-b67d-11e5-f667-ba2e7c3c1b23',
user_name: 'rt@email.com',
sale_date: '2016-01-21T15:59:26Z',
created_at: '2016-01-21 15:59:26',
updated_at: '2016-01-21 15:59:26',
total_price: 95,
total_cost: 0,
total_tax: 0,
tax_name: 'No Tax',
note: '',
status: 'OPEN',
short_code: 'hirhau',
invoice_number: '20',
return_for: '',
register_sale_products: [ [Object] ],
totals:
{
total_tax: 0,
total_price: 95,
total_payment: 0,
total_to_pay: 95 },
register_sale_payments: [],
taxes: [ [Object] ]
}
}