Orders

Orders

Order managing functions

Constructor

new Orders(api)

Main constructor

Source:
Parameters:
Name Type Description
api MkmApi

Parent api to make the calls

Methods

(async) acceptCancellation(idOrder, relistItemsopt) → {Promise}

Accept cancellation of a single order.
It is just a shorthand to modifyOrder(idOrder, 'acceptCancellation', '', relistItems)

Source:
Parameters:
Name Type Attributes Default Description
idOrder Number

Order to be cancelled

relistItems Boolean <optional>
false

Relist items of the order after the cancellation

Returns:
Type:
Promise

Operation result

(async) cancel(idOrder) → {Promise}

Cancel an order.
It is just a shorthand to modifyOrder(idOrder, 'cancel')

Source:
Parameters:
Name Type Description
idOrder Number

Order to be cancelled

Returns:
Type:
Promise

Operation result

(async) confirmReception(idOrder) → {Promise}

Confirm reception of an order.
It is just a shorthand to modifyOrder(idOrder, 'confirmReception')

Source:
Parameters:
Name Type Description
idOrder Number

Order to be marked as received

Returns:
Type:
Promise

Operation result

(async) evaluate(idOrder, evaluation) → {Promise}

Evaluate an order. Grading values are:

  • 1: very good
  • 2: good
  • 3: neutral
  • 4: bad
  • 10: n/a
Source:
Parameters:
Name Type Attributes Description
idOrder Number

Order to evaluate

evaluation Object

Evaluation information

searchParams.evaluationGrade 1 | 2 | 3 | 4 | 10 <optional>

General grade

searchParams.itemDescription 1 | 2 | 3 | 4 | 10 <optional>

Description grading

searchParams.packaging 1 | 2 | 3 | 4 | 10 <optional>

Packaging grading

searchParams.speed 1 | 2 | 3 | 4 | 10 <optional>

Speed grading

searchParams.comment String <optional>

Comment

searchParams.complaint Array.<String> <optional>

List of complaints. Posible values are:

  • badCommunication
  • incompleteShipment
  • notFoil
  • rudeSeller
  • shipDamage
  • unorderedShipment
  • wrongEd
  • wrongLang
Returns:
Type:
Promise

Operation result

(async) getOrderById(idOrder) → {Promise}

Get all the information fo a single order

Source:
Parameters:
Name Type Description
idOrder Number

id of the order

Returns:
Type:
Promise

Order information

(async) getOrders(isBuyer, state, startopt) → {Promise}

Get all orders done as a buyer or seller in a specific state

Source:
Parameters:
Name Type Attributes Default Description
isBuyer Boolean

Return order done as buyer, is set to false it will return orders done as seller)

state 'bought' | 'paid' | 'sent' | 'received' | 'lost' | 'cancelled' | Number

Return orders in the specified state, if sent as a number possible values are:

  • 1: bought
  • 2: paid
  • 4: sent
  • 8: received
  • 32: lost
  • 128: cancelled
start Number <optional>
null

Paginate results starting with this element, only 100 elements will be returned

Returns:
Type:
Promise

List of all Orders matching the filters

(async) markAsSent(idOrder) → {Promise}

Mark as sent an order.
It is just a shorthand to modifyOrder(idOrder, 'send')

Source:
Parameters:
Name Type Description
idOrder Number

Order to be marked as sent

Returns:
Type:
Promise

Operation result

(async) modifyOrder(idOrder, action, reasonopt, relistItemsopt) → {Promise}

Modify an order (mark as sent, mark received, request cancel, aceept cancel or cancel)

Source:
Parameters:
Name Type Attributes Default Description
idOrder Number

id of the order to be modified

action 'send' | 'confirmReception' | 'cancel' | 'requestCancellation' | 'acceptCancellation'

Action to perform on the order, possible values for action:

  • send: can be performed by the seller, if the current state is paid
  • confirmReception: can be performed by the buyer, if the current state is sent
  • cancel: can be performed by the seller, if the current state is bought for more than 7 days; can be performed by the buyer, if the current state is paid for more than 7 days
  • requestCancellation: can be performed by both, if the state is not yet sent, the additional key reason is required; if the seller requests cancellation, an optional key relistItems can be provided to indicate, if the articles of the order should be relisted after the cancellation request was accepted by the buyer
  • acceptCancellation: can be performed by both (but must be opposing actor), if the state is cancellationRequested; if the seller accepts the cancellation request, an optional key relistItems can be provided to indicate, if the articles of the order should be relisted thereafter
reason String <optional>
''

Reason of the cancellation (only needed if action is 'requestCancellation')

relistItems Boolean <optional>
false

Relist items after the cancellation is resolved (only used if action is 'requestCancellation' or 'acceptCancellation')

Returns:
Type:
Promise

Operation result

(async) requestCancellation(idOrder, reasonopt, relistItemsopt) → {Promise}

Accept cancellation of a single order.
It is just a shorthand to modifyOrder(idOrder, 'requestCancellation', reason, relistItems)

Source:
Parameters:
Name Type Attributes Default Description
idOrder Number

Order to be cancelled

reason String <optional>
''

Reason for the cancellation

relistItems Boolean <optional>
false

Relist item after the cancellation have been resolved

Returns:
Type:
Promise

operation result

(async) setTrackingNumber(idOrder, trackingNumber) → {Promise}

Sets the tracking number for an order as a seller

Source:
Parameters:
Name Type Description
idOrder Number

Order to modify

trackingNumber String

Tracking number

Returns:
Type:
Promise

Operation result