Skip to content

Modify orderItem.create()

Administrator requested to merge add-post-order-items into master

The structure of an order-item that we get from the API (orderItem.get()) is different from what the API expects to receive to add a new one (POST). Moreover, the POST method returns an empty body (no dict). We want this API to return a the corresponding new orderItem instance when using the method orderItem.create().

Therefore, we created the class requests/new_line_request which copies the model of what the API expects as post https://app.swaggerhub.com/apis/Masmovil/b2bapico/0.0.1#/newLineRequest

The create method now uses that class to filter the input information (new_order_item) to send to POST, and also uses its method newLineRequest.to_order_item() to refactor the common information and be able to build an OrderItem instance, which will be the result of OrderItem.create().

Merge request reports

Loading